home *** CD-ROM | disk | FTP | other *** search
/ Delphi Programmer's Power Pack / Delphi Volume 1.iso / e_to_l / flicplay / flicplay.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-09-15  |  17.2 KB  |  685 lines

  1. {+--------------------------------------------------------------------------+
  2.  | Component: TFlicPlayer
  3.  | Created: 3/30/96 2:58:22 PM
  4.  | Author:  Jeff Kinzer
  5.  | Copyright 1996, all rights reserved.
  6.  | Description: Plays Autodesk Animations (.FLI & .FLC)
  7.  | Version: 1.0
  8.  | Revision: 1
  9.  | VCS Filename: FlicPlay.Pav
  10.  +--------------------------------------------------------------------------+}
  11. unit FlicPlay;
  12.  
  13. interface
  14.  
  15. uses
  16.    SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  17.    Forms, Dialogs, ExtCtrls, StdCtrls, Menus, FlicDef;
  18.  
  19. type
  20.    TTransition = (trNone, trFadeBlack, trFadeWhite);
  21.    TPlaySpeed = 0..1000;
  22.    TDesignedSpeed = TPlaySpeed;
  23.    TFlicFrames = 0..High(LongInt);
  24.    TPlayLoops = 0..High(Integer);
  25.    TPlayPosition = TFlicFrames;
  26.    TChangemode = (cmPlay, cmStop, cmPause);
  27.    TPlayStatus = (psStopped, psQueued, psPlaying, psPaused, psDone);
  28.    TTransitionTime = 0..High(Integer);
  29.    TPlayType = (ptFlic, ptDIB);
  30.  
  31.    TFlicPlayer = class(TWinControl)
  32.    private
  33.       FFileType: TPlayType;
  34.       FTimeOut: TTransitionTime;
  35.       FTimeIn: TTransitionTime;
  36.       FStatus: TPlayStatus;
  37.       FAutoPlay: Boolean;
  38.       FTransitionIn: TTransition;
  39.       FTransitionOut: TTransition;
  40.       FAutoSize: Boolean;
  41.       FPosition: TPlayPosition;
  42.       FFileName: TFileName;
  43.       FSpeed: TPlaySpeed;
  44.       FDesignedSpeed: TDesignedSpeed;
  45.       FFrames: TFlicFrames;
  46.       FLoops: TPlayLoops;
  47.       FPlaying: Boolean;
  48.       FStopped: Boolean;
  49.       FPaused: Boolean;
  50.       FOnPlay: TNotifyEvent;
  51.       FOnPause: TNotifyEvent;
  52.       FOnStop: TNotifyEvent;
  53.       FAnimWnd,
  54.       FFlicWnd: HWnd;
  55.       function GetFileName: TFileName;
  56.       procedure SetFileName(newValue: TFileName);
  57.       function GetSpeed: TPlaySpeed;
  58.       procedure SetSpeed(newValue: TPlaySpeed);
  59.       function GetDesignedSpeed: TDesignedSpeed;
  60.       procedure SetDesignedSpeed(newValue: TDesignedSpeed);
  61.       function GetFrames: TFlicFrames;
  62.       procedure SetFrames(newValue: TFlicFrames);
  63.       function GetLoops: TPlayLoops;
  64.       procedure SetLoops(newValue: TPlayLoops);
  65.       function GetPlaying: Boolean;
  66.       procedure SetPlaying(newValue: Boolean);
  67.       function GetStopped: Boolean;
  68.       procedure SetStopped(newValue: Boolean);
  69.       function GetPaused: Boolean;
  70.       procedure SetPaused(newValue: Boolean);
  71.       function RunTime: Boolean;        { Returns true if it's run-time when called. }
  72.       function GetPosition: TPlayPosition;
  73.       procedure SetPosition(newValue: TPlayPosition);
  74.       function GetAutoSize: Boolean;
  75.       procedure SetAutoSize(newValue: Boolean);
  76.       function GetTransitionIn: TTransition;
  77.       procedure SetTransitionIn(newValue: TTransition);
  78.       function GetTransitionOut: TTransition;
  79.       procedure SetTransitionOut(newValue: TTransition);
  80.       function GetAutoPlay: Boolean;
  81.       procedure SetAutoPlay(newValue: Boolean);
  82.       function GetStatus: TPlayStatus;
  83.       procedure SetStatus(newValue: TPlayStatus);
  84.       function GetTimeIn: TTransitionTime;
  85.       procedure SetTimeIn(newValue: TTransitionTime);
  86.       function GetTimeOut: TTransitionTime;
  87.       procedure SetTimeOut(newValue: TTransitionTime);
  88.       function GetFileType: TPlayType;
  89.       procedure SetFileType(newValue: TPlayType);
  90.    protected
  91.       procedure TriggerPlayEvent; virtual;
  92.       procedure TriggerPauseEvent; virtual;
  93.       procedure TriggerStopEvent; virtual;
  94.       procedure WMMove(var Msg: TWMMove); message WM_Move;
  95.       procedure WMSize(var Msg: TWMSize); message WM_Size;
  96.       procedure WMCreate(var Msg: TWMCreate); message WM_CREATE;
  97.       procedure WMDestroy(var Msg: TWMDestroy); message WM_DESTROY;
  98.       procedure ResizeComponent; dynamic;
  99.       procedure ChangeMode(Mode: TChangeMode); virtual;
  100.       function GetValueOf(Value: LongInt): LongInt;
  101.    public
  102.       constructor Create(Owner: TComponent); override;
  103.       procedure Play; virtual;
  104.       procedure Pause; virtual;
  105.       procedure Stop; virtual;
  106.       property Stopped: Boolean read GetStopped write SetStopped default True;
  107.       property Paused: Boolean read GetPaused write SetPaused default False;
  108.       procedure LoadFromFile(FileStr: TFileName); virtual;
  109.       property AnimationHandle: HWnd read FFlicWnd;
  110.       function Next: Boolean; virtual;
  111.       function Prev: Boolean; virtual;
  112.       procedure First; virtual;
  113.       procedure Last; virtual;
  114.       function MoveBy(Amount: LongInt): Boolean; virtual;
  115.       function MoveTo(Frame: LongInt): Boolean; virtual;
  116.    published
  117.       property FileName: TFileName read GetFileName write SetFileName;
  118.       property Speed: TPlaySpeed read GetSpeed write SetSpeed default 0;
  119.       property DesignedSpeed: TDesignedSpeed read GetDesignedSpeed write SetDesignedSpeed;
  120.       property Frames: TFlicFrames read GetFrames write SetFrames;
  121.       property Loops: TPlayLoops read GetLoops write SetLoops default 1;
  122.       property Playing: Boolean read GetPlaying write SetPlaying default False;
  123.       property Position: TPlayPosition read GetPosition write SetPosition;
  124.       property Color;
  125.       property Ctl3D;
  126.       property DragCursor;
  127.       property DragMode;
  128.       property ParentColor;
  129.       property ParentCtl3D;
  130.       property ParentShowHint;
  131.       property PopupMenu;
  132.       Property OnPlay: TNotifyEvent read FOnPlay write FOnPlay;
  133.       Property OnPause: TNotifyEvent read FOnPause write FOnPause;
  134.       Property OnStop: TNotifyEvent read FOnStop write FOnStop;
  135.       property OnClick;
  136.       property OnDblClick;
  137.       property OnDragDrop;
  138.       property OnDragOver;
  139.       property OnEndDrag;
  140.       property OnEnter;
  141.       property OnExit;
  142.       property OnKeyDown;
  143.       property OnKeyPress;
  144.       property OnKeyUp;
  145.       property OnMouseDown;
  146.       property OnMouseMove;
  147.       property OnMouseUp;
  148.       property AutoSize: Boolean read GetAutoSize write SetAutoSize default True;
  149.       property TransitionIn: TTransition read GetTransitionIn write SetTransitionIn default trFadeBlack;
  150.       property TransitionOut: TTransition read GetTransitionOut write SetTransitionOut default trFadeBlack;
  151.       property AutoPlay: Boolean read GetAutoPlay write SetAutoPlay default False;
  152.       property Status: TPlayStatus read GetStatus write SetStatus default psStopped;
  153.       property TimeIn: TTransitionTime read GetTimeIn write SetTimeIn;
  154.       property TimeOut: TTransitionTime read GetTimeOut write SetTimeOut;
  155.       property FileType: TPlayType read GetFileType write SetFileType;
  156.    end;
  157.  
  158. function StartPlay(AnimWin, FocusWin: HWnd): Boolean;
  159. procedure Register;
  160.  
  161. implementation
  162.  
  163. function TFlicPlayer.GetFileType: TPlayType;
  164. begin
  165.    FFileType := TPlayType(Word(GetValueOf(AA_FILETYPE)));
  166.    Result := FFileType;
  167. end;
  168.  
  169. procedure TFlicPlayer.SetFileType(NewValue: TPlayType);
  170. begin
  171. end;
  172.  
  173.  
  174. function TFlicPlayer.GetTimeOut: TTransitionTime;
  175. begin
  176.    FTimeOut := GetValueOf(AA_TIMEOUT);
  177.    Result := FTimeOut;
  178. end;
  179.  
  180. procedure TFlicPlayer.SetTimeOut(NewValue: TTransitionTime);
  181. begin
  182.    if FTimeOut <> NewValue then
  183.    begin
  184.       FTimeOut := NewValue;
  185.       aaSetParm(FFlicWnd, AA_TIMEOUT, 0, NewValue);
  186.    end;
  187. end;
  188.  
  189. function TFlicPlayer.GetTimeIn: TTransitionTime;
  190. begin
  191.    FTimeIn := GetValueOf(AA_TIMEIN);
  192.    Result := FTimeIn;
  193. end;
  194.  
  195. procedure TFlicPlayer.SetTimeIn(NewValue: TTransitionTime);
  196. begin
  197.    if FTimeIn <> NewValue then
  198.    begin
  199.       FTimeIn := NewValue;
  200.       aaSetParm(FFlicWnd, AA_TIMEIN, 0, NewValue);
  201.    end;
  202. end;
  203.  
  204. function TFlicPlayer.GetStatus: TPlayStatus;
  205. var
  206.    Num: Word;
  207. begin
  208.    Num := Word(GetValueOf(AA_STATUS)) + 1;
  209.    FStatus := TPlayStatus(Num);
  210.    Result := FStatus;
  211. end;
  212.  
  213. procedure TFlicPlayer.SetStatus(NewValue: TPlayStatus);
  214. begin
  215. end;
  216.  
  217. function TFlicPlayer.GetAutoPlay: Boolean;
  218. begin
  219.    Result := FAutoPlay;
  220. end;
  221.  
  222. procedure TFlicPlayer.SetAutoPlay(NewValue: Boolean);
  223. begin
  224.    if FAutoPlay <> NewValue then
  225.    begin
  226.       FAutoPlay := NewValue;
  227.       if FAutoPlay and (FFlicWnd <> 0) and (not FPlaying) then
  228.          Play
  229.       else
  230.          if (FFlicWnd <> 0) and (not FStopped) then
  231.             Stop;
  232.    end;
  233. end;
  234.  
  235. function TFlicPlayer.GetTransitionIn: TTransition;
  236. var
  237.    Num: Word;
  238. begin
  239.    Num := Word(GetValueOf(AA_TRANSIN));
  240.    FTransitionIn := TTransition(Num);
  241.    Result := FTransitionIn;
  242. end;
  243.  
  244. procedure TFlicPlayer.SetTransitionIn(NewValue: TTransition);
  245. begin
  246.    if FTransitionIn <> NewValue then
  247.    begin
  248.       FTransitionIn := NewValue;
  249.       aaSetParm(FFlicWnd, AA_TRANSIN, 0, Ord(NewValue));
  250.    end;
  251. end;
  252.  
  253. function TFlicPlayer.GetTransitionOut: TTransition;
  254. var
  255.    Num: Word;
  256. begin
  257.    Num := Word(GetValueOf(AA_TRANSOUT));
  258.    FTransitionOut := TTransition(Num);
  259.    Result := FTransitionOut;
  260. end;
  261.  
  262. procedure TFlicPlayer.SetTransitionOut(NewValue: TTransition);
  263. begin
  264.    if FTransitionOut <> NewValue then
  265.    begin
  266.       FTransitionOut := NewValue;
  267.       aaSetParm(FFlicWnd, AA_TRANSOUT, 0, Ord(NewValue));
  268.    end;
  269. end;
  270.  
  271. function TFlicPlayer.Next: Boolean;
  272. begin
  273.    FPosition := GetValueOf(AA_POSITION);
  274.    if FPlaying or FPaused then
  275.       Stop;
  276.    Result := FPaused;
  277.    if FPosition < (Frames - 1) then
  278.       Position := FPosition + 1
  279.    else
  280.       First;
  281. end;
  282.  
  283. function TFlicPlayer.Prev: Boolean;
  284. begin
  285.    FPosition := GetValueOf(AA_POSITION);
  286.    if FPlaying or FPaused then
  287.       Stop;
  288.    Result := FPaused;
  289.    if FPosition > 0 then
  290.       Position := FPosition - 1
  291.    else
  292.       Last;
  293. end;
  294.  
  295. procedure TFlicPlayer.First;
  296. begin
  297.    FPosition := GetValueOf(AA_POSITION);
  298.    if FPlaying or FPaused then
  299.       Stop;
  300.    Position := 0;
  301. end;
  302.  
  303. procedure TFlicPlayer.Last;
  304. begin
  305.    FPosition := GetValueOf(AA_POSITION);
  306.    if FPlaying or FPaused then
  307.       Stop;
  308.    if FPosition <> (Frames - 1) then
  309.       Position := Frames - 1;
  310. end;
  311.  
  312. function TFlicPlayer.MoveBy(Amount: LongInt): Boolean;
  313. var
  314.    ToEnd, ToStart: LongInt;
  315. begin
  316.    ToEnd := (FFrames - 1) - FPosition;
  317.    ToStart := FPosition;
  318.    if FPlaying or FPaused then
  319.       Stop;
  320.    if Amount > 0 then
  321.    begin
  322.       if Amount > ToEnd then
  323.          MoveTo(Amount - ToEnd)
  324.       else
  325.          MoveTo(FPosition + Amount);
  326.    end
  327.    else
  328.    begin
  329.       if Amount > ToStart then
  330.          MoveTo((FFrames - 1) - (Amount - ToStart))
  331.       else
  332.          MoveTo(FPosition + Amount);
  333.    end;
  334. end;
  335.  
  336. function TFlicPlayer.MoveTo(Frame: LongInt): Boolean;
  337. begin
  338.    Result := (FPosition <> Frame) and (Frame >= 0) and (Frame < FFrames);
  339.    if Result then
  340.       aaSetParm(FFlicWnd, AA_POSITION, 0, Frame);
  341.    FPosition := GetValueOf(AA_POSITION);
  342. end;
  343.  
  344.  
  345. function TFlicPlayer.GetAutoSize: Boolean;
  346. begin
  347.    Result := FAutoSize;
  348. end;
  349.  
  350. procedure TFlicPlayer.SetAutoSize(NewValue: Boolean);
  351. begin
  352.    if FAutoSize <> NewValue then
  353.    begin
  354.       FAutoSize := NewValue;
  355.       if FAutoSize then
  356.       begin
  357.          Width := GetValueOf(AA_WIDTH);
  358.          Height := GetValueOf(AA_HEIGHT);
  359.       end;
  360.    end;
  361. end;
  362.  
  363. function TFlicPlayer.GetPosition: TPlayPosition;
  364. begin
  365.    FPosition := GetValueOf(AA_POSITION);
  366.    Result := FPosition;
  367. end;
  368.  
  369. procedure TFlicPlayer.SetPosition(NewValue: TPlayPosition);
  370. begin
  371.    if FPosition <> NewValue then
  372.    begin
  373.       if FPlaying or FPaused then
  374.          Stop;
  375.       MoveTo(NewValue);
  376.    end;
  377. end;
  378.  
  379. function TFlicPlayer.GetFileName: TFileName;
  380. begin
  381.    Result := FFileName;
  382. end;
  383.  
  384. procedure TFlicPlayer.SetFileName(NewValue: TFileName);
  385. begin
  386.    if not FileExists(NewValue) then
  387.       Exit;
  388.    if FFileName <> NewValue then
  389.    begin
  390.       if FPlaying or FPaused then
  391.          Stop;
  392.       FFileName := NewValue;
  393.       LoadFromFile(FFileName);
  394.    end;
  395. end;
  396.  
  397. function TFlicPlayer.GetSpeed: TPlaySpeed;
  398. begin
  399.    FSpeed := GetValueOf(AA_SPEED);
  400.    Result := FSpeed;
  401. end;
  402.  
  403. procedure TFlicPlayer.SetSpeed(NewValue: TPlaySpeed);
  404. begin
  405.    if FSpeed <> NewValue then
  406.    begin
  407.       FSpeed := NewValue;
  408.       aaSetParm(FFlicWnd, AA_SPEED, 0, Ord(NewValue));
  409.    end;
  410. end;
  411.  
  412. function TFlicPlayer.GetDesignedSpeed: TDesignedSpeed;
  413. begin
  414.    FDesignedSpeed := GetValueOf(AA_DESIGNSPEED);
  415.    Result := FDesignedSpeed;
  416. end;
  417.  
  418. procedure TFlicPlayer.SetDesignedSpeed(NewValue: TDesignedSpeed);
  419. begin
  420. end;
  421.  
  422. function TFlicPlayer.GetFrames: TFlicFrames;
  423. begin
  424.    FFrames := GetValueOf(AA_FRAMES);
  425.    Result := FFrames;
  426. end;
  427.  
  428. procedure TFlicPlayer.SetFrames(NewValue: TFlicFrames);
  429. begin
  430. end;
  431.  
  432. function TFlicPlayer.GetLoops: TPlayLoops;
  433. begin
  434.    FLoops := GetValueOf(AA_LOOPS);
  435.    Result := FLoops;
  436. end;
  437.  
  438. procedure TFlicPlayer.SetLoops(NewValue: TPlayLoops);
  439. begin
  440.    if FLoops <> NewValue then
  441.    begin
  442.       FLoops := NewValue;
  443.       aaSetParm(FFlicWnd, AA_LOOPS, 0, FLoops);
  444.    end;
  445. end;
  446.  
  447. function TFlicPlayer.GetPlaying: Boolean;
  448. begin
  449.    Result := FPlaying;
  450. end;
  451.  
  452. procedure TFlicPlayer.SetPlaying(NewValue: Boolean);
  453. begin
  454.    if FPlaying <> NewValue then
  455.    begin
  456.       FPlaying := NewValue;
  457.       if FPlaying then
  458.          Play
  459.       else
  460.          AutoPlay := False;
  461.    end;
  462. end;
  463.  
  464. function TFlicPlayer.GetStopped: Boolean;
  465. begin
  466.    Result := FStopped;
  467. end;
  468.  
  469. procedure TFlicPlayer.SetStopped(NewValue: Boolean);
  470. begin
  471.    if FStopped <> NewValue then
  472.    begin
  473.       FStopped := NewValue;
  474.       if FStopped then
  475.          Stop
  476.       else
  477.          Play;
  478.    end;
  479. end;
  480.  
  481. function TFlicPlayer.GetPaused: Boolean;
  482. begin
  483.    Result := FPaused;
  484. end;
  485.  
  486. procedure TFlicPlayer.SetPaused(NewValue: Boolean);
  487. begin
  488.    if FPaused <> NewValue then
  489.    begin
  490.       FPaused := NewValue;
  491.       if FPaused then
  492.          Pause
  493.       else
  494.          Play;
  495.    end;
  496. end;
  497.  
  498. procedure TFlicPlayer.Play;
  499. begin
  500.    FPosition := GetValueOf(AA_POSITION);
  501.    if not FStopped and not FPaused then
  502.       Exit;
  503.    if StartPlay(FFlicWnd, Handle) then
  504.    begin
  505.       ChangeMode(cmPlay);
  506.       if RunTime then
  507.          TriggerPlayEvent;
  508.    end
  509.    else
  510.       ChangeMode(cmStop);
  511. end;
  512.  
  513. procedure TFlicPlayer.Pause;
  514. begin
  515.    FPosition := GetValueOf(AA_POSITION);
  516.    if not FPlaying then
  517.       Exit;
  518.    if aaPause(FFlicWnd) then
  519.    begin
  520.       ChangeMode(cmPause);
  521.       if RunTime then
  522.          TriggerPauseEvent;
  523.    end
  524.    else
  525.       ChangeMode(cmPlay);
  526. end;
  527.  
  528. procedure TFlicPlayer.Stop;
  529. begin
  530.    FPosition := GetValueOf(AA_POSITION);
  531.    if not FPlaying and not FStopped then
  532.       Exit;
  533.    if aaStop(FFlicWnd) then
  534.    begin
  535.       ChangeMode(cmStop);
  536.       if RunTime then
  537.          TriggerStopEvent;
  538.    end
  539.    else
  540.       ChangeMode(cmPlay);
  541. end;
  542.  
  543. procedure TFlicPlayer.TriggerPlayEvent;
  544. begin
  545.    if Assigned(FOnPlay) then
  546.       FOnPlay(Self);
  547. end;
  548.  
  549. procedure TFlicPlayer.TriggerPauseEvent;
  550. begin
  551.    if Assigned(FOnPause) then
  552.       FOnPause(Self);
  553. end;
  554.  
  555. procedure TFlicPlayer.TriggerStopEvent;
  556. begin
  557.    if Assigned(FOnStop) then
  558.       FOnStop(Self);
  559. end;
  560.  
  561. procedure TFlicPlayer.ChangeMode(Mode: TChangeMode);
  562. begin
  563.    FPlaying := (Mode = cmPlay);
  564.    FStopped := (Mode = cmStop);
  565.    FPaused := (Mode = cmPause);
  566. end;
  567.  
  568. procedure TFlicPlayer.WMMove(var Msg: TWMMove);
  569. var
  570.    LocalBoundsRect: TRect;
  571. begin
  572.    inherited;
  573.    LocalBoundsRect := BoundsRect;
  574.    BoundsRect := LocalBoundsRect;
  575. end;
  576.  
  577. procedure TFlicPlayer.WMSize(var Msg: TWMSize);
  578. begin
  579.    inherited;
  580.    ResizeComponent;
  581. end;
  582.  
  583. procedure TFlicPlayer.ResizeComponent;
  584. begin
  585.    if FAutoSize then
  586.    begin
  587.       Width := GetValueOf(AA_WIDTH);
  588.       Height := GetValueOf(AA_HEIGHT);
  589.    end;
  590. end;
  591.  
  592. function TFlicPlayer.RunTime: Boolean;
  593. begin
  594.    RunTime := not (csDesigning in ComponentState);
  595. end;
  596.  
  597. constructor TFlicPlayer.Create(Owner: TComponent);
  598. begin
  599.    inherited Create(Owner);
  600.    FSpeed := 0;
  601.    FFrames := 0;
  602.    FLoops := 1;
  603.    FPlaying := False;
  604.    FStopped := True;
  605.    FPaused := False;
  606.    ResizeComponent;
  607.    FPosition := 0;
  608.    FFlicWnd := 0;
  609.    FAutoSize := True;
  610.    FTransitionIn := trFadeBlack;
  611.    FTransitionOut := trFadeBlack;
  612.    FAutoPlay := False;
  613.    FFileType := ptFlic;
  614. end;
  615.  
  616. procedure TFlicPlayer.WMCreate(var Msg: TWMCreate);
  617. begin
  618.    aaOpen;
  619.    inherited;
  620. end;
  621.  
  622. procedure TFlicPlayer.WMDestroy(var Msg: TWMDestroy);
  623. begin
  624.    if FFlicWnd <> 0 then
  625.       aaUnload(FFlicWnd);
  626.    inherited;
  627. end;
  628.  
  629. procedure TFlicPlayer.LoadFromFile(FileStr: TFileName);
  630. var
  631.    PFile: PChar;
  632.    PLen: Integer;
  633.    LoadW, LoadH: Integer;
  634. begin
  635.    PLen := Length(FileStr);
  636.    try
  637.       if FFlicWnd <> 0 then
  638.          aaUnload(FFlicWnd);
  639.       GetMem(PFile,PLen);
  640.       StrPCopy(PFile,FileStr);
  641.       LoadW := 0;
  642.       LoadH := 0;
  643.       if not FAutoSize then
  644.       begin
  645.          LoadW := Width;
  646.          LoadH := Height;
  647.       end;
  648.       FFlicWnd := aaLoad(PFile, Handle, 0, 0, 0, LoadW, LoadH, 0, 0);
  649.       if FAutoSize then
  650.       begin
  651.          Width := GetValueOf(AA_WIDTH);
  652.          Height := GetValueOf(AA_HEIGHT);
  653.       end;
  654.       FPosition := GetValueOf(AA_POSITION);
  655.    finally
  656.       FreeMem(PFile, PLen);
  657.    end;
  658.    if FAutoPlay then
  659.       Play;
  660. end;
  661.  
  662. function TFlicPlayer.GetValueOf(Value: LongInt): LongInt;
  663. begin
  664.    Result := aaGetParm(FFlicWnd, Value);
  665. end;
  666.  
  667. function StartPlay(AnimWin, FocusWin: HWnd): Boolean;
  668. var
  669.    SaveFocus: HWnd;
  670. begin
  671.    SaveFocus := GetActiveWindow;
  672.    LockWindowUpdate(FocusWin);
  673.    Result := aaPlay(AnimWin);
  674.    SetActiveWindow(SaveFocus);
  675.    LockWindowUpdate(0);
  676. end;
  677.  
  678. procedure Register;
  679. begin
  680.    RegisterComponents('Custom', [TFlicPlayer]);
  681. end;
  682.  
  683. initialization
  684. end.
  685.